package auth

import groovy.transform.CompileStatic

class User4Core {

    String residentId
    OrganizationType orgType
    String orgId
    boolean wechatBound = false
    boolean alipayBound = false
    Date dateCreated
    Date lastUpdated
    SortedSet<User4Platform> platforms

    static hasMany = [platforms: User4Platform]

    @CompileStatic
    static enum OrganizationType {
        Finance(1), Government(9), Housekeeping(2), Logistics(3), Recovery(5)

        final int id;

        OrganizationType(int id) {
            this.id = id
        }
    }

    static constraints = {
        residentId(nullable: true)
        orgType(nullable: true)
        orgId(nullable: true)
        wechatBound()
        alipayBound()
        dateCreated()
        lastUpdated()
    }

    static mapping = {
        orgType enumType: 'identity'
    }
}
